//
//  UITableViewCell+ZW.m
//  BTShike2
//
//  Created by ZDTX on 2020/12/16.
//  Copyright © 2020 刘军林. All rights reserved.
//

#import "UITableViewCell+ZW.h"
#import <objc/runtime.h>

@implementation UITableViewCell (ZW)

+ (void)load{
    Method method1 = class_getInstanceMethod([self class],  NSSelectorFromString(@"addSubview:"));
    Method method2 = class_getInstanceMethod([self class], @selector(zw_addSubview:));
        method_exchangeImplementations(method1, method2);
}

- (void)addSubview:(UIView *)view{
    [super addSubview:view];
}

- (void)zw_addSubview:(UIView *)view{
    if  ([view isKindOfClass:NSClassFromString(@"UITableViewCellContentView")]) {
        [self zw_addSubview:view];
    } else {
        [self.contentView addSubview:view];
    }
}
@end
